package com.hzw.saas.api.product.enums;

import java.util.Objects;

/**
 * 支付模式
 *
 * @author zzl
 * @since 01/28/2021
 */
public enum PayMode {

    ONLINE_PAY(1, "线上支付"),
    OFFLINE_PAY(2, "线下支付");

    private final Integer value;
    private final String text;

    public Integer value() {
        return this.value;
    }

    public String text() {
        return this.text;
    }

    PayMode(Integer value, String text) {
        this.value = value;
        this.text = text;
    }

    public static String text(Integer value) {
        for (PayMode payMode : PayMode.values()) {
            if (Objects.equals(payMode.value, value)) {
                return payMode.text;
            }
        }
        return null;
    }

    public static PayMode instance(Integer value) {
        for (PayMode payMode : PayMode.values()) {
            if (Objects.equals(payMode.value, value)) {
                return payMode;
            }
        }
        return null;
    }

}
